---
title: Memory
editUrl: https://github.com/toolbeam/openauth/blob/master/packages/openauth/src/storage/memory.ts
description: Reference doc for the Memory storage adapter.
---

import { Segment, Section, NestedTitle, InlineSection } from 'toolbeam-docs-theme/components'
import { Tabs, TabItem } from '@astrojs/starlight/components'

<div class="tsdoc">
<Section type="about">
Configure OpenAuth to use a simple in-memory store.

:::caution
This is not meant to be used in production.
:::

This is useful for testing and development. It's not meant to be used in production.

```ts
import { MemoryStorage } from "@openauthjs/openauth/storage/memory"

const storage = MemoryStorage()

export default issuer({
  storage,
  // ...
})
```

Optionally, you can persist the store to a file.

```ts
MemoryStorage({
  persist: "./persist.json"
})
```
</Section>
---
## Methods
### MemoryStorage
<Segment>
<Section type="signature">
```ts
MemoryStorage(input?)
```
</Section>
<Section type="parameters">
#### Parameters
- <p><code class="key">input?</code> [<code class="type">MemoryStorageOptions</code>](#memorystorageoptions)</p>
</Section>
<InlineSection>
**Returns** <code class="type">StorageAdapter</code>
</InlineSection>
</Segment>
## MemoryStorageOptions
<Segment>
<Section type="parameters">
- <p>[<code class="key">persist?</code>](#memorystorageoptions.persist) <code class="primitive">string</code></p>
</Section>
Configure the memory store.
</Segment>
<NestedTitle id="memorystorageoptions.persist" Tag="h4" parent="MemoryStorageOptions.">persist?</NestedTitle>
<Segment>
<Section type="parameters">
<InlineSection>
**Type** <code class="primitive">string</code>
</InlineSection>
</Section>
Optionally, backup the store to a file. So it'll be persisted when the issuer restarts.
```ts
{
  persist: "./persist.json"
}
```
</Segment>
</div>